package www.sharetime.weshare.utils;

import android.content.Context;
import android.graphics.Bitmap;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.target.Target;

import java.io.File;

/**
 * File Description  : 对图片加载框的二次封装
 *
 * @author : zhanggeng
 * @email : zhanggengdyx@gmail.com
 * @date : 2017/9/19 10:21
 * @version     : v1.0
 * **************修订历史*************
 */

public class ImageLoader {
    public static void loadImage(String url, ImageView imageView) {
        Glide.with(imageView.getContext())
                .load(url)
                .dontAnimate()
                .into(imageView);
    }

    public static void loadImage(File file, ImageView imageView) {
        Glide.with(imageView.getContext())
                .load(file)
                .dontAnimate()
                .into(imageView);
    }

    public static void loadImage(Context context, String url, Target<Bitmap> target){
        Glide.with(context)
                .load(url)

                .asBitmap()
                .into(target);
    }
}
